package kku.cs.fgl.timeline;

import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;

import kku.cs.fgl.Actor;

public class AlphaAction extends ActorAction {

	private float start;

	private float target;

	public AlphaAction(int duration, Actor actor,float target) {
		super(duration, actor);
		this.target = target;
	}


	public void start() {
		start = actor.getAlphaLevel();
		if(target>1)target=1;
	}

	public void action(int time) {
		float d = target - start;

		if (getDuration() <= 0) {
			actor.setAlphaLevel(target);
		} else {
			actor.setAlphaLevel(ease(start,d));
		}
	}
	public double getTarget() {
		return target;
	}
	public void setTarget(float target) {
		this.target = target;
	}
}
